package main

import "fmt"

//主函数模块
func main() {
	//创建一个区块
	//var block *Block = createBlock([]byte{}, "第一个区块")
	//fmt.Printf("上一区块的hash值%x:",block.PreBlockHash)
	//fmt.Println()
	//fmt.Printf("当前区块的hash值%x:",block.Hash)
	//fmt.Println()
	//fmt.Println("当前区块的数据",string(block.Data))
	//创建第一个区块链
	firstBlockChain := CreateBlockChain()
	firstBlockChain.AddBlock("jack向sheep转了50比特币")
	firstBlockChain.AddBlock("jack向sheep转了80比特币")
	for i, block := range firstBlockChain.blockChain{
		fmt.Println("------------------------------------------")
		fmt.Printf("第%d个区块\n",i)
		fmt.Printf("上一区块的hash值:%x\n",(*block).PreBlockHash)
		fmt.Printf("当前区块的hash值:%x\n",(*block).Hash)
		fmt.Println("当前区块的数据:",string(block.Data))
		fmt.Println("当前区块的随机值:",block.Nonce)
	}
}
